#!/usr/bin/env python

import csv
import matplotlib.pyplot as plt
import pandas as pd
import sys
import os

def show_figrue(file, label_title):
    raw_list = []
    
    csvf = csv.reader(open(file))
    
    for line in csvf:
        raw_list.append(line)
    
    df = pd.DataFrame(raw_list)
    print(df)
    x = df[0].tolist()
    y = df[1].tolist()
    
    xv = [eval(i) for i in x]
    yv = [eval(i) for i in y]
    
    plt.plot(xv, yv, label=label_title)
    plt.legend()

print(len(sys.argv))
if len(sys.argv) < 2:
    sys.exit()
print("will show")
for i in range(1, len(sys.argv)):
    show_figrue(sys.argv[i], os.path.basename(sys.argv[i]).split('.')[0])

plt.show()
